<?php


namespace app\api\model;


class User extends Base
{
    protected $autoWriteTimestamp = 'datetime';
    //隐藏返回字段
    protected $hidden = [
        "create_time","update_time","password","status","openid"
    ];

    public function address(){
        return $this->hasOne('Adress','user_id','id');
    }

    public function check_exist($openid){
        $res = $this->where('openid',$openid)->find();//存在返回1,不存在返回0
        return $res;
    }

}